package com.jieshen.JDBC.Dao;

import com.jieshen.JDBC.domain.UserUploadFile;
import com.jieshen.JDBC.utils.JDBCUtils;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;

public class UploadFileImpl implements UploadFile{

    @Override
    public List<UserUploadFile> getAllUploadFile() {
        JdbcTemplate template = new JdbcTemplate(JDBCUtils.getDataSource());
        String sql = "select * from uploadfile";
        List<UserUploadFile> query = template.query(sql, new BeanPropertyRowMapper<UserUploadFile>(UserUploadFile.class));
        return query;
    }
}
